import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'name',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '机构编码',
    align: "center",
    dataIndex: 'sysOrgCode'
  },
  {
    title: '费用',
    align: "center",
    dataIndex: 'fee'
  },
  {
    title: '开始公里',
    align: "center",
    dataIndex: 'beginKm'
  },
  {
    title: '结束公里',
    align: "center",
    dataIndex: 'endKm'
  },
  {
    title: '费用类型',
    align: "center",
    dataIndex: 'feeType'
  },
  {
    title: '说明',
    align: "center",
    dataIndex: 'description'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "机构编码",
    field: 'sysOrgCode',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "费用",
    field: 'fee',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'name',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入name!'},
             ];
    },
  },
  {
    label: '费用',
    field: 'fee',
    component: 'InputNumber',
  },
  {
    label: '开始公里',
    field: 'beginKm',
    component: 'InputNumber',
  },
  {
    label: '结束公里',
    field: 'endKm',
    component: 'InputNumber',
  },
  {
    label: '费用类型',
    field: 'feeType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入费用类型!'},
             ];
    },
  },
  {
    label: '说明',
    field: 'description',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: 'name',order: 0,view: 'text', type: 'string',},
  sysOrgCode: {title: '机构编码',order: 1,view: 'text', type: 'string',},
  fee: {title: '费用',order: 2,view: 'number', type: 'number',},
  beginKm: {title: '开始公里',order: 3,view: 'number', type: 'number',},
  endKm: {title: '结束公里',order: 4,view: 'number', type: 'number',},
  feeType: {title: '费用类型',order: 5,view: 'text', type: 'string',},
  description: {title: '说明',order: 6,view: 'text', type: 'string',},
};
